﻿using System;

namespace McDonalds
{
    [NoCompile]
    public class Coupon
    {
        public bool ck;        
        public string lIU;
        public string iU;
        public bool dis;
    }    

    [ImportClass(String.Empty, "MCModels")]
    public class MCModels
    {
        public MCModels()
        {
        }

        public static Coupon[] couponList;
        public static int couponIndex;
        public static Coupon[] buyList;

        public static Coupon[] GetBuyList()
        {
            MCModels.buyList = new Coupon[0];
            if (MCModels.couponList.Length > 0)
            {
                for (var i = 0; i < MCModels.couponList.Length; i++)
                {
                    if (MCModels.couponList[i].ck == true)
                    {
                        var buyItem = MCModels.couponList[i];
                        MCModels.buyList.Push(buyItem);
                    }
                }

                for (var i = 0; i < MCModels.buyList.Length; i++)
                {
                    MCModels.buyList[i].dis = true;
                }
            }

            return MCModels.buyList;
        }

        public static Coupon[] GetCouponList()
        {

            if (MCModels.couponList.Length > 0)
            {
                for (var i = 0; i < MCModels.couponList.Length; i++)
                {
                    MCModels.couponList[i].dis = false;
                }
            }

            return MCModels.couponList;
        }
    }
}
